import 'package:color_dart/RgbaColor.dart';
import "package:flutter/material.dart";
import 'package:im_flutter_sdk_example/jsonserialize/home/data.dart';
import 'package:im_flutter_sdk_example/utils/constants.dart';
import 'package:im_flutter_sdk_example/utils/global.dart';
import 'package:im_flutter_sdk_example/utils/screen.dart';

class ProjectItem extends StatelessWidget {
  final ProjectData item;
  const ProjectItem({Key key, this.item}) : super(key: key);

  Widget _buildImage(String path) {
    return Image.network(
      G.thumbImage112_80(path),
      width: 224.w,
      height: 160.h,
      fit: BoxFit.cover,
    );
  }

  @override
  Widget build(BuildContext context) {
    return ListTile(
        onTap: () => {G.pushNamed('/act_detail')},
        title: Text("${item.projectName}",
            maxLines: 2,
            overflow: TextOverflow.ellipsis,
            style: mainTitleStyle),
        trailing: Container(
            width: 112, height: 100, child: _buildImage('${item.photos[0]}')),
        subtitle: Container(
          margin: EdgeInsets.only(top: 4),
          child: Column(
            children: [
              Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
                Text('${item.createTime}',
                    style:
                        TextStyle(color: rgba(163, 163, 163, 1), fontSize: 12)),
              ]),
              Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
                Text('${item.cityName}',
                    style:
                        TextStyle(color: rgba(163, 163, 163, 1), fontSize: 12)),
                Container(
                  child: item.valuationType == 2
                      ? Row(
                          crossAxisAlignment: CrossAxisAlignment.baseline,
                          children: [
                            Text('¥',
                                style: TextStyle(
                                    color: rgba(234, 92, 92, 1), fontSize: 12)),
                            Text('${item.valuation}',
                                style: TextStyle(
                                    color: rgba(234, 92, 92, 1), fontSize: 15)),
                          ],
                        )
                      : Text('面议',
                          style: TextStyle(
                              color: rgba(234, 92, 92, 1), fontSize: 15)),
                ),
              ])
            ],
          ),
        ));
  }
}
